home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / wtek0693.zip / OOPALLEY.ZIP / ORDCLTN.H < prev    next >
C/C++ Source or Header  |  1993-04-27  |  3KB  |  75 lines

  1. #ifndef ORDEREDCLTN_H
  2. #define ORDEREDCLTN_H
  3.  
  4. #include "seqcltn.h"
  5. #include "arrayob.h"
  6.  
  7. extern const Class class_OrderedCltn;
  8.  
  9. class SortedCltn;
  10.  
  11. ////////////////////////////////////////////////////////////
  12. // class OrderedCltn (declaration)
  13. ////////////////////////////////////////////////////////////
  14. class OrderedCltn : public SeqCltn {
  15.     int endIndex;
  16.     ArrayOb contents;
  17.     Object* addAtIndex(int i, const Object& ob);
  18.     void errEmpty(const char* fn) const;
  19.     void errNotFound(const char* fn, const Object& ob) const;
  20.     Object* removeAtIndex(int i);
  21.     friend SortedCltn;
  22. public:
  23.                 // constructors, destructors
  24.                 OrderedCltn(unsigned size =CLTN_DEFAULT_CAPACITY);
  25.                 OrderedCltn(const OrderedCltn&);
  26.  
  27.                 // operators
  28.     bool        operator!=(const OrderedCltn& a) const   { return !(*this==a); }
  29.     void        operator=(const OrderedCltn&);
  30.     bool        operator==(const OrderedCltn&) const;
  31.     Object*&    operator[](int i) const 
  32.                 {
  33.                     if ((unsigned)i > endIndex) indexRangeErr();
  34.                     return contents[i];
  35.                 }
  36.     OrderedCltn operator&(const SeqCltn& cltn) const;   // concatenation operator
  37.     void        operator&=(const SeqCltn& cltn);
  38.  
  39.  
  40.     virtual Object*         add(const Object&);
  41.     virtual Object*         addAfter(const Object& ob, const Object& newob);
  42.     virtual Object*         addAllLast(const OrderedCltn&);
  43.     virtual Object*         addBefore(const Object& ob, const Object& newob);
  44.     virtual Collection&     addContentsTo(Collection& cltn) const;
  45.     virtual Object*         addLast(const Object& ob);
  46.     virtual Object*         after(const Object&) const;
  47.     virtual Object*&        at(int i) const;
  48.     virtual void            atAllPut(const Object& ob);
  49.     virtual Object*         before(const Object&) const;
  50.     virtual unsigned        capacity() const;
  51.     virtual void            deepenShallowCopy();
  52.     virtual Object*         first() const;
  53.     virtual unsigned        hash() const;
  54.     virtual int             indexOf(const Object& ob) const;
  55.     virtual int             indexOfSubCollection(const SeqCltn& cltn, 
  56.                                                  int start=0) const;
  57.     virtual const Class*    isA() const;
  58.     virtual bool            isEmpty() const;
  59.     virtual bool            isEqual(const Object&) const;
  60.     virtual Object*         last() const;
  61.     virtual unsigned        occurrencesOf(const Object&) const;
  62.     virtual void            printOn(ostream& strm) const;
  63.     virtual Object*         remove(const Object&);
  64.     virtual Object*         removeId(const Object&);
  65.     virtual Object*         removeLast();
  66.     virtual void            replaceFrom(int start, int stop,
  67.                                         const SeqCltn& replacement, int startAt =0);
  68.     virtual void            reSize(unsigned newSize);
  69.     virtual unsigned        size() const;
  70.     virtual void            sort();
  71.     virtual const Class*    species() const;
  72. };
  73.  
  74. #endif
  75.